REM RESTful DDS is a prototyping effort to demonstrate how DDS could be combined
REM with HTTP clients, extending the realm of pub/sub distribution to true wide
REM area networking.
REM
REM Copyright (C) 2009 PrismTech Ltd.
REM reinier.torenbeek@gmail.com
REM
REM This library is free software; you can redistribute it and/or
REM modify it under the terms of the GNU Lesser General Public
REM License Version 3 dated 29 June 2007, as published by the
REM Free Software Foundation.
REM
REM This library is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
REM Lesser General Public License for more details.
REM
REM You should have received a copy of the GNU Lesser General Public
REM License along with restful-dds; if not, write to the Free Software
REM Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

REM Change the settings below if you want to use external jars from a different
REM location. By default, the jars included with the project are used
REM as well as the standard jar location for OpenSplice.

REM Test for OSPL_HOME setting to avoid action without OpenSplice properly
REM installed.
IF "_%OSPL_HOME%"==_ GOTO NoSplice

REM External jars required
SET RESTLET_INTF_JAR=external\org.restlet.jar
SET RESTLET_IMPL_JAR=external\com.noelios.restlet.jar
SET GSON_JAR=external\gson-1.4.jar
SET DDS_JAR=%OSPL_HOME%\jar\dcpssaj.jar

REM Built in test uses OpenSplice's example Chat.idl
SET TUTORIAL_DIR=%OSPL_HOME%\examples\dcps\standalone\Java\Tutorial
SET CHAT_IDL=%TUTORIAL_DIR%\Chat.idl

REM Set GWT_HOME explicitly if you do not want it
REM to be in PATH or CLASSPATH, either here or
REM wherever you prefer, like:
REM SET GWT_HOME=C:\gwt-2.0.1

REM First test whether the environment variable has
REM already been set.
IF NOT _%GWT_HOME%==_ GOTO GWTFound

REM Try to find GWT installation...
REM First look in the PATH
ECHO GWT_HOME not known, trying to find it in PATH
SET GWT_FILE=gwt-user.jar
SET PATHQ=%PATH%
:WhilePath
    IF "%PATHQ%"=="" GOTO WendPath
    FOR /F "delims=;" %%i IN ("%PATHQ%") DO SET CURDIR=%%i
    FOR /F "delims=; tokens=1,*" %%i IN ("%PATHQ%") DO SET PATHQ=%%j
    IF NOT EXIST "%CURDIR%\%GWT_FILE%" GOTO WhilePath
    SET GWT_HOME=%CURDIR%
    GOTO GWTFound
:WendPath
ECHO GWT not found in PATH, trying CLASSPATH
SET PATHQ=%CLASSPATH%
:WhileClassPath
    IF "%PATHQ%"=="" GOTO WendClassPath
    FOR /F "delims=;" %%i IN ("%PATHQ%") DO SET CURDIR=%%i
    FOR /F "delims=; tokens=1,*" %%i IN ("%PATHQ%") DO SET PATHQ=%%j
    IF NOT EXIST "%CURDIR%\%GWT_FILE%" GOTO WhileClassPath
    SET GWT_HOME=%CURDIR%
    GOTO GWTFound
:WendClassPath
ECHO GWT not found in CLASSPATH
GOTO NoGWT

:GWTFound
REM Only print info if this GWT is newly found
IF NOT _%CURDIR%==_ ECHO Found GWT in directory %GWT_HOME%
SET PATHQ=
SET CURDIR=

GOTO End

:NoGWT
ECHO Can not find GWT anywhere, will not build the Battleship WebDemo
GOTO End

:NoSplice
ECHO OpenSplice environment not properly set, exiting now
EXIT

:End